package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Mark;
import cn.wolfcode.trip.base.mapper.MarkMapper;
import cn.wolfcode.trip.base.service.IMarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MarkServiceImpl implements IMarkService {
    @Autowired
    private MarkMapper markMapper;

    @Override
    public void saveOrUpdate(Mark mark) {
      if (mark.getUser()==null){
          markMapper.insert(mark);
      }else{
          markMapper.updateByPrimaryKey(mark);
      }

    }

    @Override
    public Mark selectByUserId(Long userId) {
        Mark mark=markMapper.selectByUserId(userId);
        return mark;
    }

}
